var ji=0;
var ou=0;
function dg(shu){
    if(shu%2==0){
        for(var i=2;i<=shu;i+=2)
        {
            ou+=(1/i);
        }
        return ou;
    }else{
        for(var i=1;1<=shu;i+=2){
            ji+=(1/i)
        }
        return ji;
    }
}
console.log(dg(5));